package com.example.index.service

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import com.example.index.R
import kotlinx.android.synthetic.main.activity_remote_event_bus.*
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode

class RemoteEventBusActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_remote_event_bus)
        EventBus.getDefault().register(this)
    }


    @Subscribe(threadMode = ThreadMode.MAIN)
    fun onNewBind(event: BindEvent) {

        textView.text = if (event.bind) "new bind" else "bind disconnected"
    }

}
